package main

import (
	"github.com/lxn/walk"
	. "github.com/lxn/walk/declarative"
)

// IV 声明图片域控件
var IV  *walk.ImageView
var inTE,outTE  *walk.TextEdit


//声明将要展示的图片资源
var imageToShow walk.Image

var mw =MainWindow{

	//窗口标题
	Title:   "尖叫的Demo",

	//可拉伸的最小尺寸
	MinSize: Size{500, 400},
	MaxSize: Size{800, 600},
	//主布局：垂直布局
	Layout:  VBox{},

	//窗口中的所有控件
	Children: []Widget{

		//水平分割器（水平小布局）
		HSplitter{
			//局部水平排列的控件们
			Children: []Widget{
				VSplitter{
					Children: []Widget{
						PushButton{
							Text: "停止",
							OnClicked: DifficultyAdjust(DifficultyChannel,0),
						},
						PushButton{
							Text: "难度1",
							OnClicked: DifficultyAdjust(DifficultyChannel,1),
						},
						PushButton{
							Text: "难度2",
							OnClicked: DifficultyAdjust(DifficultyChannel,2),
						},
						PushButton{
							Text: "难度3",
							OnClicked: DifficultyAdjust(DifficultyChannel,3),
						},
						PushButton{
							Text: "难度4",
							OnClicked: DifficultyAdjust(DifficultyChannel,4),
						},
						TextEdit{
							AssignTo: &outTE,
							MinSize:  Size{
								Width:  50,
								Height: 20,
							},
							MaxSize:  Size{
								Width:  200,
								Height: 100,
							},
							ReadOnly: true,
						},
						TextEdit{
							AssignTo: &inTE,
							MinSize:  Size{
								Width:  50,
								Height: 20,
							},
							MaxSize:  Size{
								Width:  200,
								Height: 100,
							},
							OnKeyDown: KeyScan,
						},
					},
				},

				ImageView{
					AssignTo: &IV,
					//image为初始图案
					Image: "./pic/hutaofengmian.jpeg",
					MinSize: Size{
						Width:  400,
						Height: 400,
					},
					MaxSize: Size{
						Width:  600,
						Height: 600,
					},
				},
			},

		},

		//普通按钮
		PushButton{
			//按钮文本
			Text: "操作说明",
			//响应函数
			OnClicked: BottomButtonPush(),
		},

	},
}

